<ul class="breadcrumb">
	<li><a href="/admin">Dashboard</a><span class="divider">&raquo;</span></li>
	<li class="active">Manager Product</li>
</ul>

<div class="row-fluid">
	<div class="span12">
		<div class="nonboxy-widget">
			<div class="widget-head">
				<h5 style="display: inline;">List Products

				</h5>
				<a clas="add-new" style="float:right; margin-top:10px" href="/admin/products/add"><i class="color-icons add_co"></i>Add New Product</a>
			</div>

			<?php echo $this->Session->flash(); ?>

			<table class="data-tbl-simple table table-bordered">
			<thead>
				<tr>
					<th> # </th>
					<th> Image </th>
					<th> Name </th>
					<th> Price </th>
					<th> Discounts </th>
					<th> Category </th>
					<th style="width:85px" align="center"> Action </th>
				</tr>
				</thead>

				<tbody>
				<?php if(!empty($products)) foreach($products as $item): ?>
					<tr>
						<td> <a href=""><?php echo $item[$als]['id']?></a> </td>

						<td class="span2">
							<?php if(!empty($item[$als]['image'])):?>
							<img src="<?php echo PUBLIC_THUMB_SHOW. $item[$als]['image'] ?>"/>
							<?php endif;?>
						</td>

						<td><?php echo $item[$als]['name']?></td>

						<td><?php echo number_format($item[$als]['price']) ?></td>

						<td><?php echo number_format($item[$als]['discounts']) ?></td>

						<td><?php echo $categories[$item[$als]['category_id']] ?></td>

						<td class="action">
							<?php
								$class = 'unlocked';
								$title = 'Unlock';
								$status = 4;
								$confirm = 'Are you sure unlock product?';
								if($item[$als]['status'] == 4 ) {
									$class = 'locked_2';
									$title = 'Lock';
									$status = 5;
									$confirm = 'Are you sure lock product?';
								}
							?>
							<a href="/admin/products/add/<?php echo $item[$als]['id']?>" class="btn btn-mini btn-primary"><i class="icon-pencil icon-white"></i> Edit</a>

							<a href="/admin/products/changeStatus/<?php echo $item[$als]['id'].'/'.$status?>" onclick="return confirmChangeStatus($(this), '<?php echo $confirm; ?>', 'Ok')" class="btn btn-mini btn-danger">
								<i class="white-icons <?php echo $class; ?>"></i> <?php echo $title ?>
							</a>

							<a href="/admin/products/changeStatus/<?php echo $item[$als]['id']?>/9" onclick="return confirmChangeStatus($(this), 'Are you sure delete product?', 'Ok')" class="btn btn-mini btn-danger">
								<i class="icon-trash icon-white"></i> Delete
							</a>
						</td>
					</tr>
				<?php  endforeach;?>
				</tbody>
			</table>
		</div>
	</div>
</div>

